<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

/**
 * 用户举报
 */
class UserReport extends Model
{
    protected $table = 'report';
    const STATUS = [
        1 => '未处理',
        2 => '已处理',
    ];

    public function reportUser()
    {
        return $this->belongsTo(UserProfile::class, 'user_id', 'user_id');
    }

    public function reportedUser()
    {
        return $this->belongsTo(UserProfile::class, 'reported_user_id', 'user_id');
    }

    public function reportedUserItem()
    {
        return $this->belongsTo(User::class, 'reported_user_id', 'id');
    }

    public function getImagesAttribute($images)
    {
        return json_decode($images, true);
    }
}
